from .getsnmp import snmpget
from .walksnmp import snmpwalk,_snmpwalk
from .setsnmp import snmpset
from pysnmp.hlapi.v3arch.asyncio import Integer,Unsigned32,OctetString
import asyncio

wr_type = "node"

class impCtrlMENA():
    def walk_impCtrlMENA(self,ip:str):
        return snmpwalk(ip,wr_type,"impCtrlMENA")

    def set_impCtrlMC0Ena(self,ip:str,value):
        return snmpset(ip,wr_type,"impCtrlMC0Ena",Integer(value))
    def get_impCtrlMC0Ena(self,ip:str):
        return snmpget(ip,wr_type,"impCtrlMC0Ena")
    def set_impCtrlMC1Ena(self,ip:str,value):
        return snmpset(ip,wr_type,"impCtrlMC1Ena",Integer(value))
    def get_impCtrlMC1Ena(self,ip:str):
        return snmpget(ip,wr_type,"impCtrlMC1Ena")
    
    def set_impCtrlUtcCodingEna(ip:str,value):
        return snmpset(ip,wr_type,"impCtrlUtcCodingEna",Integer(value))
    def get_impCtrlUtcCodingEna(ip:str):
        return snmpget(ip,wr_type,"impCtrlUtcCodingEna")
    
    def set_impCtrlInterlockEna(ip:str,value):
        return snmpset(ip,wr_type,"impCtrlInterlockEna",Integer(value))
    def get_impCtrlInterlockEna(ip:str):
        return snmpget(ip,wr_type,"impCtrlInterlockEna")
    
    def set_impCtrlHeartbeatEna(ip:str,value):
        return snmpset(ip,wr_type,"impCtrlHeartbeatEna",Integer(value))
    def get_impCtrlHeartbeatEna(ip:str):
        return snmpget(ip,wr_type,"impCtrlHeartbeatEna")

class impBPSConfig():
    def walk_impBPSConfig(self,ip:str):
        return snmpwalk(ip,wr_type,"impBPSConfig")
    def get_impCtrlTrigger(self,ip:str):
        return snmpget(ip,wr_type,"impCtrlTrigger")
    
    def set_impCtrlDeviceNum(self,ip:str,value):
        return snmpset(ip,wr_type,"impCtrlDeviceNum",Unsigned32(value))
    def get_impCtrlDeviceNum(self,ip:str):
        return snmpget(ip,wr_type,"impCtrlDeviceNum")
    
    def set_impCtrlHeartGroup(self,ip:str,value):
        return snmpset(ip,wr_type,"impCtrlHeartGroup",Unsigned32(value))
    def get_impCtrlHeartGroup(self,ip:str):
        return snmpget(ip,wr_type,"impCtrlHeartGroup")
    
    def set_impCtrlHeartCycle(self,ip:str,value):
        return snmpset(ip,wr_type,"impCtrlHeartCycle",Unsigned32(value))
    def get_impCtrlHeartCycle(self,ip:str):
        return snmpget(ip,wr_type,"impCtrlHeartCycle")
    
    def set_impCtrlHeartOffset(self,ip:str,value):
        return snmpset(ip,wr_type,"impCtrlHeartOffset",Unsigned32(value))
    def get_impCtrlHeartOffset(self,ip:str):
        return snmpget(ip,wr_type,"impCtrlHeartOffset")
    def set_impCtrlCarrier(self,ip:str,value):
        return snmpset(ip,wr_type,"impCtrlCarrier",Unsigned32(value))
    def get_impCtrlCarrier(self,ip:str):
        return snmpget(ip,wr_type,"impCtrlCarrier")
class impDelayConfig():
    def walk_impDelayConfig(self,ip:str):
        return snmpwalk(ip,wr_type,"impDelayConfig")
    
    def set_FineDelayAux0(self,ip:str,value):
        return snmpset(ip,wr_type,"FineDelayAux0",Unsigned32(value))
    def get_FineDelayAux0(self,ip:str):
        return snmpget(ip,wr_type,"FineDelayAux0")
    
    def set_FineDelayAux1(self,ip:str,value):
        return snmpset(ip,wr_type,"FineDelayAux1",Unsigned32(value))
    def get_FineDelayAux1(self,ip:str):
        return snmpget(ip,wr_type,"FineDelayAux1")
    
class impPolarityConfig():
    def walk_impPolarityConfig(self,ip:str):
        return snmpwalk(ip,wr_type,"impPolarityConfig")
    
    def set_PolarityMC0(self,ip:str,value):
        return snmpset(ip,wr_type,"PolarityMC0",Integer(value))
    def get_PolarityMC0(self,ip:str):
        return snmpget(ip,wr_type,"PolarityMC0")
    
    def set_PolarityMC1(self,ip:str,value):
        return snmpset(ip,wr_type,"PolarityMC1",Integer(value))
    def get_PolarityMC1(self,ip:str):
        return snmpget(ip,wr_type,"PolarityMC1")
    
class impWavePatternConfig():
    def walk_impWavePatternConfig(self,ip:str):
        return snmpwalk(ip,wr_type,"impWavePatternConfig")
    
    def set_WavePatternIndexMC0(self,ip:str,value):
        return snmpset(ip,wr_type,"WavePatternIndexMC0",Unsigned32(value))
    def get_WavePatternIndexMC0(self,ip:str):
        return snmpget(ip,wr_type,"WavePatternIndexMC0")
    
    def set_WavePatternIndexMC1(self,ip:str,value):
        return snmpset(ip,wr_type,"WavePatternIndexMC1",Unsigned32(value))
    def get_WavePatternIndexMC1(self,ip:str):
        return snmpget(ip,wr_type,"WavePatternIndexMC1")
    
class impNetAddrConfig():
    def walk_impNetAddrConfig(self,ip:str):
        return snmpwalk(ip,wr_type,"impNetAddrConfig")
    
    def set_impWriteIP(self,ip:str,value):
        return snmpset(ip,wr_type,"impWriteIP",OctetString(value))
    
    def set_impWriteMAC(self,ip:str,value):
        return snmpset(ip,wr_type,"impWriteMAC",OctetString(value))
    def get_impReadPCIP(self,ip:str):
        return snmpget(ip,wr_type,"impReadPCIP")
    def get_impReadPCMAC(self,ip:str):
        return snmpget(ip,wr_type,"impReadPCMAC")
    
    def get_impReadM1IP(self,ip:str):
        return snmpget(ip,wr_type,"impReadM1IP")
    def get_impReadM1MAC(self,ip:str):
        return snmpget(ip,wr_type,"impReadM1MAC")
    
    def get_impReadM2IP(self,ip:str):
        return snmpget(ip,wr_type,"impReadM2IP")
    def get_impReadM2MAC(self,ip:str):
        return snmpget(ip,wr_type,"impReadM2MAC")

class impCtrlApply():
    def set_impCtrlApply(self,ip,value):
        return snmpset(ip,wr_type,"impCtrlApply",Integer(value))
     
class impWavePatternTable():
    def walk_impWaveTableMC0(self,ip:str):
            
        return asyncio.run(_snmpwalk(ip,".1.3.6.1.4.1.96.103.1.2"))

    def walk_impWaveTableMC1(self,ip:str):
            
        return asyncio.run(_snmpwalk(ip,".1.3.6.1.4.1.96.103.1.3"))

class impWavePatternSetGroup():
    def walk_impWavePatternSetGroup(self,ip:str):
        return asyncio.run(_snmpwalk(ip,".1.3.6.1.4.1.96.103.1.6"))
    
    def set_impWavePatternSet(self,ip:str,value):
        return snmpset(ip,wr_type,"impWavePatternSet",Integer(value))
    def get_impWavePatternSet(self,ip:str):
        return snmpget(ip,wr_type,"impWavePatternSet")
    
    def set_impWavePatternMC(self,ip:str,value):
        return snmpset(ip,wr_type,"impWavePatternMC",Integer(value))
    def get_impWavePatternMC(self,ip:str):
        return snmpget(ip,wr_type,"impWavePatternMC")
    
    def set_impWavePatternIndex(self,ip:str,value):
        return snmpset(ip,wr_type,"impWavePatternIndex",Unsigned32(value))
    def get_impWavePatternIndex(self,ip:str):
        return snmpget(ip,wr_type,"impWavePatternIndex")
    
    def set_impWavePatternDelay(self,ip:str,value):
        return snmpset(ip,wr_type,"impWavePatternDelay",Unsigned32(value))
    def get_impWavePatternDelay(self,ip:str):
        return snmpget(ip,wr_type,"impWavePatternDelay")
    
    def set_impWavePatternWidth(self,ip:str,value):
        return snmpset(ip,wr_type,"impWavePatternWidth",Unsigned32(value))
    def get_impWavePatternWidth(self,ip:str):
        return snmpget(ip,wr_type,"impWavePatternWidth")
    
    def set_impWavePatternIdle4ns(self,ip:str,value):
        return snmpset(ip,wr_type,"impWavePatternIdle4ns",Unsigned32(value))
    def get_impWavePatternIdle4ns(self,ip:str):
        return snmpget(ip,wr_type,"impWavePatternIdle4ns")
    
    def set_impWavePatternIdle100ms(self,ip:str,value):
        return snmpset(ip,wr_type,"impWavePatternIdle100ms",Unsigned32(value))
    def get_impWavePatternIdle100ms(self,ip:str):
        return snmpget(ip,wr_type,"impWavePatternIdle100ms")

class impInterlockReadGroup():
    def walk_impInterlockReadGroup(self,ip:str):
        return snmpwalk(ip,wr_type,"impInterlockReadGroup")
    def get_impLocalInterlock(self,ip:str):
        return snmpget(ip,wr_type,"impLocalInterlock")
    
    def get_impFinalEna(self,ip:str):
        return snmpget(ip,wr_type,"impFinalEna")